package jomi.fatiasdovos.fatias.parser;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.List;

/**
 * Created by jorgemachado on 27/12/13.
 */
public class Group {

    String name;
    String jqueryCotacao;
    String upCotacao;

    public static Map<String,Group> groups = new HashMap<String,Group>();


    public Group(Properties props,String suffix)
    {
        name = props.getProperty("source.group." + suffix + ".name");
        jqueryCotacao = props.getProperty("source.group." + suffix + ".jquery.cotacao");
        upCotacao = props.getProperty("source.group." + suffix + ".jquery.up");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getJqueryCotacao() {
        return jqueryCotacao;
    }

    public void setJqueryCotacao(String jqueryCotacao) {
        this.jqueryCotacao = jqueryCotacao;
    }

    public String getUpCotacao() {
        return upCotacao;
    }

    public void setUpCotacao(String upCotacao) {
        this.upCotacao = upCotacao;
    }

    public static void initGroups(SourcesProperties props)
    {
        if(groups.size() > 0)
            return;
        String[] grps = SourcesProperties.getProperty("source.active.groups").split(" ");
        for(String grp: grps)
        {
            Group g = new Group(props.getProps(),grp);
            groups.put(grp,g);
        }

    }
}
